import request from '@/router/axios';

export const getList = (params,data) => {
  return request({
    url: '/api/beetles-business/offer/post-page',
    method: 'POST',
    params,
    data
  })
}

export const getUserOfferList = (current, size, params) => {
  return request({
    url: '/api/beetles-business/offer/user-offer-list',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}

export const getCustomerOfferList = (current, size, params) => {
  return request({
    url: '/api/beetles-business/offer/customer-offer-list',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}

export const getDetail = (id) => {
  return request({
    url: '/api/beetles-business/offer/detail',
    method: 'get',
    params: {
      id
    }
  })
}

export const remove = (ids) => {
  return request({
    url: '/api/beetles-business/offer/remove',
    method: 'post',
    params: {
      ids,
    }
  })
}

export const add = (row) => {
  return request({
    url: '/api/beetles-business/offer/submit',
    method: 'post',
    data: row
  })
}

export const update = (row) => {
  return request({
    url: '/api/beetles-business/offer/submit',
    method: 'post',
    data: row
  })
}

export const customer = ()=>{
  return request({
    url:'/api/beetles-business/customer/select',
    method:'get'
  })
}

export const changeStatus = (id,status) =>{
  return request({
    url:'/api/beetles-business/offer/update/status',
    method:'put',
    params:{
      id:id,
      status:status,
    }
  })
}

export const loadBcCreativeRequestInfo = (params) => {
  return request({
    url: '/api/beetles-business/offer/bc-creative-request-info',
    method: 'get',
    params: {
      ...params
    }
  })
}

export const getOfferList = (params = {}) => {
  return request({
    url: '/api/beetles-business/offer/get-select',
    method: 'get',
    params: {
      ...params
    }
  })
}

export const geActiveAndStop = () => {
  return request({
    url: '/api/beetles-business/offer/get-active-and-stop-select',
    method: 'get'
  })
}

export const getOfferName = (offerId) => {
  return request({
    url: '/api/beetles-business/offer/get-offer-name',
    method: 'get',
    params: { offerId }
  })
}

/*���涩��֪ͨ����*/
export const saveOfferConf = (data) =>{
  return request ({
    url: '/api/beetles-business/offer_notice_conf/save',
    method: 'post',
    data: data,
  })
}

/*���涩��֪ͨ����*/
export const getOfferConf = (params) =>{
  return request ({
    url: '/api/beetles-business/offer_notice_conf/get',
    method: 'get',
    params: params,
  })
}

//获取客户经理
export const getCustomerManager = () =>{
  return request ({
    url:'/api/blade-user/select-user?roleAlias=customer_manager',
    method:'get'
  })
}

//获取销售经理
export const getSalesManager = () =>{
  return request ({
    url:'/api/blade-user/select-user?roleAlias=sales_manager',
    method:'get'
  })
}

//全局通知设置配置
export const getGlobalConfiguration = () =>{
  return request ({
    url: '/api/beetles-business/offer_notice_conf/check_globalConf',
    method: 'get',
  })
}

// 获取评论列表
export const getCommentPage = params =>{
  return request ({
    url: '/api/beetles-business/offer-comment/comment-page',
    method: 'GET',
    params
  })
}
// 创建评论
export const createOfferComment = data =>{
  return request ({
    url: '/api/beetles-business/offer-comment/create',
    method: 'post',
    data
  })
}
// 改变PIN
export const changePin = data =>{
  return request ({
    url: '/api/beetles-business/offer-comment/changePin',
    method: 'post',
    data
  })
}
//
export const getAccountList = (current, size, params) => {
  return request({
    url: '/api/beetles-business/account/page',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}
// 删除评论
export const removeComment = id=>{
  return requegetCommentPagest ({
    url: '/api/beetles-business/offer-comment/remove',
    method: 'POST',
    params:{
      id
    }
  })
}

//编辑评论
export const updateComment = data =>{
  return request ({
    url: '/api/beetles-business/offer-comment/updateComment',
    method: 'POST',
    data
  })
}

export const savePriceList = data => {
  return request ({
    url: '/api/beetles-business/offer-price/save-price-list',
    method: 'POST',
    data
  })
}

// 获取定价配置列表
export const getPricePage = params =>{
  return request ({
    url: '/api/beetles-business/offer-price/price-page',
    method: 'GET',
    params
  })
}

// 获取定价变更记录列表
export const getPriceChangelogPage = params =>{
  return request ({
    url: '/api/beetles-business/offer-price-changelog/list',
    method: 'GET',
    params
  })
}
